package com.guet.game.airplanes;

import com.guet.game.World;
import com.guet.game.airplanes.dao.FlyingObj;
import com.guet.game.utils.Audio;
import com.guet.game.utils.Images;
import com.guet.game.airplanes.dao.Plane;
import com.guet.game.weapon.Bullet;

import java.awt.image.BufferedImage;

public class BigAirplane extends FlyingObj implements Plane {
    float speed;
    int score;

    int currentHp;
    int maxHp;

    public BigAirplane() {
        super(66, 89);
        score = 5;
        speed = 1f;

        maxHp = 100;
        currentHp = maxHp;

    }

    @Override
    public void move() {
        y += speed;
    }

    @Override
    public Bullet[] shoot() {
        return super.shoot();
    }

    @Override
    public BufferedImage getImage() {
        // TODO Auto-generated method stub
        if (state == LIFT) {
            return Images.bigAirplanes[index++ % 2];
        } else if (state == DEAD) {
            if (boomIndex == Images.booms.length) {
                this.state = REMOVE;
                return null;
            }
            return Images.booms[boomIndex++];
        }
        return null;
    }


    @Override
    public int getScore() {
        // TODO Auto-generated method stub
        return score;
    }

    @Override
    public void TakeDamage(int damage) {
        currentHp -= damage;
        if(currentHp <= 0){
            World.score += score;
            goDead();
            new Audio("boom").Play();
        }
    }

}
